﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OAPlatform.DomainModel.Model
{

    public class User : AuthenticatableEntity
    {
        public User()
        {
            Roles = new List<Role>();
            Band = new Band();
        }

        public string Name { get; set; }
        public long BandID { get; set; }

        public virtual Band Band { get; set; }

        /// <summary>
        /// 测试User是否有所指定的权限
        /// </summary>
        /// <param name="permissionKey">需要测试的权限标识</param>
        /// <returns>有则返回true，否则返回false</returns>
        public override bool Authenticate(string permissionKey)
        {
            return base.Authenticate(permissionKey)
                || Band.Authenticate(permissionKey);
        }
    }
}
